load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "mon",
    srcs = [
        "bytes_usage.go",
        "resource.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/util/mon",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/util",
        "//pkg/util/buildutil",
        "//pkg/util/envutil",
        "//pkg/util/humanizeutil",
        "//pkg/util/ioctx",
        "//pkg/util/log",
        "//pkg/util/log/logcrash",
        "//pkg/util/metric",
        "//pkg/util/syncutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_dustin_go_humanize//:go-humanize",
    ],
)

go_test(
    name = "mon_test",
    size = "small",
    srcs = ["bytes_usage_test.go"],
    embed = [":mon"],
    deps = [
        "//pkg/settings/cluster",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/metric",
        "//pkg/util/randutil",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_stretchr_testify//require",
    ],
)
